source /mnt/sfs/asr/.bashrc
# for循环100次
input_shards_path=/mnt/sfs/asr/update_data/asr_chat_wenetspeech_enhance_2025-1-24/shards_list.txt
dataname=asr_chat_wenetspeech
mkdir -p ./data/tmp/big
split -n 8 -d -a 1 "$input_shards_path" "./data/tmp/big/shard_"

for i_hahahahahha in {0..7}
do
  input_shards_path=./data/tmp/big/shard_$i_hahahahahha
  echo "input_shards_path: $input_shards_path"
  output_dir_i=./data/tmp/little/split_shard_$i_hahahahahha
  echo "output_dir_i: $output_dir_i"
  mkdir -p "$output_dir_i"
  split -n 8 -d -a 2 "$input_shards_path" "$output_dir_i/shard_"

  for j_hahahahahha in {0..7}
  do
    # Define the conditions to skip
    skip_condition=true
    if [[ $i_hahahahahha == 0 && ( $j_hahahahahha == 0 || $j_hahahahahha == 5 || $j_hahahahahha == 6 || $j_hahahahahha == 7 ) ]] || \
       [[ $i_hahahahahha == 1 && $j_hahahahahha == 0 ]]; then
      skip_condition=false
    fi

    if $skip_condition; then
      echo "skip i_hahahahahha=$i_hahahahahha, j_hahahahahha=$j_hahahahahha"
      continue
    fi

    # Format j as a two-digit number
    j_str=$(printf "%02d" $j_hahahahahha)
    input_path_now="$output_dir_i/shard_$j_str"
    echo "input_path_now: $input_path_now"
    echo "thread_${i_hahahahahha}_$j_str"

    file_name_now="thread_${i_hahahahahha}_$j_str"
    my_named_nohup "$file_name_now" bash do_text2token.sh --dataname "$dataname" --thread_index "$j_str" --test_data_path "$input_path_now" --gpu_id "$i_hahahahahha"
    echo "thread_${i_hahahahahha}_$j_str done"
  done
done
